<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Powermeter</title>
    <link rel="stylesheet" href="./layui/css/layui.css">
</head>

<body>
    您好！
    <div>

    </div>
    当前设备列表：
    <table class="layui-hide" id="device_table"></table>
    <script src="./layui/JQuery.js"></script>
    <script src="./layui/layui.js" charset="utf-8"></script>
    <script>
        layui.use('table', function() {
            var table = layui.table;

            table.render({
                elem: '#device_table'
                ,url:'/getAllDevices'
                ,method:'post'
                ,contentType: 'application/json'
                ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                ,cols: [[
                    {field:'id', width:80, title: 'ID', sort: true}
                    ,{field:'name', width:80, title: '名称'}
                    ,{field:'type', width:80, title: '类型', sort: true}
                    ,{field:'description', width: '30%', title: '描述'}
                ]]
                ,parseData: function (res){
                    console.log(res)
                    return {
                        'code' : res.code,
                        'msg' : res.msg,
                        'count' : res.count,
                        'data' : res.data
                    }
                }
            });
        });
    </script>
</body>
</html>